﻿using System;

namespace diantou.dataModel
{
    /// <summary>
    /// OJ题目
    /// </summary>
    public abstract class problemBase
    {
        /// <summary>
        /// 题目标识
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        public int Id;
        /// <summary>
        /// 创建用户标识
        /// </summary>
        public int UserId;
        /// <summary>
        /// 第一次发布时间
        /// </summary>
        public DateTime FristTime = fastCSharp.pub.MinTime;
        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime ShowTime = fastCSharp.pub.MinTime;
        /// <summary>
        /// 自动发布时间
        /// </summary>
        //[fastCSharp.emit.dataMember(DefaultValue = "'1900/1/1'")]
        public DateTime AutoShowTime = fastCSharp.pub.MinTime;
        /// <summary>
        /// 标题
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 256)]
        public string Title;
        /// <summary>
        /// 基础分值
        /// </summary>
        public int BasePoint;
        /// <summary>
        /// 呈现类型
        /// </summary>
        public enum showType : byte
        {
            /// <summary>
            /// 显示过期
            /// </summary>
            All,
            /// <summary>
            /// 未显示
            /// </summary>
            None,
            /// <summary>
            /// 显示未过期
            /// </summary>
            Show,
            /// <summary>
            /// 显示过期
            /// </summary>
            Expired,
        }
        /// <summary>
        /// 是否发布显示
        /// </summary>
        public showType ShowType = showType.None;
        /// <summary>
        /// 是否付费结算
        /// </summary>
        public bool IsPay;

        /// <summary>
        /// 描述
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 64 << 10)]
        public string Description = string.Empty;
        /// <summary>
        /// 输入描述
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 512)]
        public string InputDescription = string.Empty;
        /// <summary>
        /// 输出描述
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 512)]
        public string OutputDescription = string.Empty;

        /// <summary>
        /// 呈现类型数量
        /// </summary>
        public static readonly int ShowTypeSize = fastCSharp.Enum.GetMaxValue<showType>(-1) + 1;
    }
    /// <summary>
    /// OJ题目
    /// </summary>
    [fastCSharp.emit.dataSerialize(IsReferenceMember = false)]
    [fastCSharp.emit.jsonSerialize(IsAllMember = true)]
    [fastCSharp.emit.jsonParse(IsAllMember = true)]
    [fastCSharp.code.cSharp.webView.clientType(Name = "diantou.problem")]
    [fastCSharp.code.cSharp.sqlModel(LogTcpCallService = "DataLog")]
    public partial class problem : problemBase
    {
        /// <summary>
        /// 验题人用户标识
        /// </summary>
        public int TestUserId;
        /// <summary>
        /// 同一版本问题标识
        /// </summary>
        public int VersionProblemId;
        /// <summary>
        /// 问题标识
        /// </summary>
        public int QuestionId;
        /// <summary>
        /// 第1个解答者用户标识
        /// </summary>
        public int TestDataUserId;
        /// <summary>
        /// 浏览次数
        /// </summary>
        public int BrowseCount;
        /// <summary>
        /// 超时限制
        /// </summary>
        public int TimeLimit;
        /// <summary>
        /// OJ同步最后更新时间
        /// </summary>
        public DateTime LastJudgeTime  = fastCSharp.pub.MinTime;
        /// <summary>
        /// 内存限制
        /// </summary>
        public long MemoryLimit;
        /// <summary>
        /// 来源说明
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 32)]
        public string Source = string.Empty;
        /// <summary>
        /// 来源链接
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 256, IsAscii = true)]
        public sqlMember.httpLinkEmpty SourceLink = string.Empty;
        /// <summary>
        /// 分组标识
        /// </summary>
        public int GroupId;
        /// <summary>
        /// 评论数
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        public int CommentCount;
        /// <summary>
        /// 标程提交用户标识
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        public int ProgramUserId;
        /// <summary>
        /// 程序测试类型
        /// </summary>
        public enum onlineJudgeType
        {
            DataTest,
            ProgramTest
        }
        /// <summary>
        /// 测试类型
        /// </summary>
        public enum judgeType : byte
        {
            /// <summary>
            /// 程序测试
            /// </summary>
            Code
        }
        /// <summary>
        /// 测试类型
        /// </summary>
        public judgeType JudgeType;
        /// <summary>
        /// 标程语言
        /// </summary>
        public judgeState.languageType ProgramLanguage;
        /// <summary>
        /// 验题程序语言
        /// </summary>
        public judgeState.languageType TestProgramLanguage;
        /// <summary>
        /// 特判程序语言
        /// </summary>
        public judgeState.languageType SpecialProgramLanguage;
        /// <summary>
        /// 输入数据格式是否合法
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        public bool IsInputFormat;
        /// <summary>
        /// 问题类型
        /// </summary>
        public enum problemType : byte
        {
            /// <summary>
            /// 所有问题
            /// </summary>
            AllProblem,
            /// <summary>
            /// 练习题
            /// </summary>
            Challenge,
            /// <summary>
            /// 竞赛题
            /// </summary>
            Contest,
            /// <summary>
            /// 教程题
            /// </summary>
            Tutorial,
            /// <summary>
            /// 开放平台试题
            /// </summary>
            Open,
        }
        /// <summary>
        /// 是否竞赛题
        /// </summary>
        public problemType ProblemType = problemType.Challenge;

        /// <summary>
        /// 输入样例
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 512)]
        public string Input = string.Empty;
        /// <summary>
        /// 输出样例
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 512)]
        public string Output = string.Empty;
        /// <summary>
        /// 输入格式化字符串
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 512)]
        public string FormatInput = string.Empty;
        /// <summary>
        /// 标程内容
        /// </summary>
        //[fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.emit.dataMember(MaxStringLength = judgeState.MaxProgramContentLength)]
        public string Program = string.Empty;
        /// <summary>
        /// 验题程序内容
        /// </summary>
        //[fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.emit.dataMember(MaxStringLength = judgeState.MaxProgramContentLength)]
        public string TestProgram = string.Empty;
        /// <summary>
        /// 特判程序内容
        /// </summary>
        //[fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        [fastCSharp.emit.dataMember(MaxStringLength = judgeState.MaxProgramContentLength)]
        public string SpecialProgram = string.Empty;
        /// <summary>
        /// 题解
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 64 << 10)]
        public string Solution = string.Empty;
        /// <summary>
        /// 输入格式
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 512)]
        public string InputFormat = string.Empty;
        /// <summary>
        /// double类型输出误差
        /// </summary>
        public double DoubleTolerance;

        #region 计算列
        /// <summary>
        /// 比赛标识
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int ContestId;
        /// <summary>
        /// 测试数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int JudgeCount;
        ///// <summary>
        ///// 程序测试AC数量
        ///// </summary>
        //[fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        //[fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        //public int AcceptedCount;
        /// <summary>
        /// 程序测试AC用户数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int AcceptedUserCount;
        /// <summary>
        /// 测试数据数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int TestDataCount;
        /// <summary>
        /// 比赛测试数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int ContestJudgeCount;
        /// <summary>
        /// 比赛测试AC用户数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int ContestAcceptedUserCount;
        /// <summary>
        /// 话题数量
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true, IsSqlStream = true)]
        public int TopicCount;
        #endregion
    }
}
